#ifndef UNITCOCUMENT_H_
#define UNITDOCUMENT_H_

#include <stdlib.h>
#include <stdio.h>
#include <cstring>
#include "../utils/Functions.h"

using namespace std;

class UnitDocument {

	private:
		int document;
		string title;
		vector <Termino> *v_terminos;
		ofstream* outputFile;

		void removeDuplicated();
		void saveOnDisk();
		unsigned int calculateDiff(vector<unsigned int> posicionesAnteriores, unsigned int posicionActual);

		int binarySearch(string token);
		int binarySearch(string token, vector<Termino>*);

		void printVTerminos();
	public:
		UnitDocument();
		~UnitDocument();
		void addTermino (string word, unsigned int pos);
		void sort();
		void setDocN (int number);
		void setTitle (string title);
		void stdOutDoc();
		int getDocN();
		vector <Termino> * getTerminos();
		Termino* getTermino (unsigned int index);
};

#endif /* UNITDOCUMENT_H_ */
